1 package jrre.gui;
2
3 import jrre.*;
4 import java.awt.*;
5 import javax.swing.*;
6 import javax.swing.tree.*;
7 import java.awt.event.*;
8
9 public class ObjectAreaGui extends JFrame {
10
11 private static JTree methodAreaTree = new JTree();
12 private static DefaultMutableTreeNode treeRoot;
13 private static DefaultTreeModel treeModel;
14
15 public ObjectAreaGui(){
16
17 super("Object Area");
18
19 // Set up and add tree.
20 treeRoot = new DefaultMutableTreeNode("Object Area");
21 treeModel = new DefaultTreeModel(treeRoot);
22
23 methodAreaTree = new JTree(treeModel);
24 Container content = getContentPane();
25 content.add(methodAreaTree);
26
27 addWindowListener(new WindowDestroyer());
28
29 setSize(300,400);
30 setLocation(100, 300);
31
32 if(JRRE.guiOn())
33 setVisible(true);
34 }
35
36 public void clear(){
37
38 treeRoot.removeAllChildren();
39 }
40
41 public void addObject(ObjectInstance objectInstance){
42
43 DefaultMutableTreeNode objectToAdd = new DefaultMutableTreeNode(objectInstance);
44 treeRoot.add(objectToAdd);
45 treeModel.reload();
46
47 TreePath path = new TreePath(objectToAdd.getPath());
48 methodAreaTree.expandPath(path);
49 }
50
51 public void removeObject(String className){
52
53 }
54
55 class WindowDestroyer extends WindowAdapter{
56 public void windowClosing(WindowEvent e){
57 System.exit(0);
58 }
59 }
60
61 }
62
This page was automatically generated by Maven